package com.rc.evcharger.service.rc;

import com.rc.evcharger.mapper.rc.RcOperatorMapper;
import com.rc.evcharger.mapper.rc.RcOrderTraceMapper;
import com.rc.evcharger.model.order.OrderInfo;
import com.rc.evcharger.model.rc.RcOrderTrace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author: yang
 * @Date: 2022/7/20 10:14
 */
@Service
public class RcOrderTraceServiceImpl implements RcOrderTraceService{

    @Autowired
    private RcOrderTraceMapper rcOrderTraceMapper;

    @Override
    public RcOrderTraceMapper getMapper() {
        return null;
    }


    @Override
    public void insertByChargeReport(OrderInfo orderInfo, BigDecimal power, BigDecimal soc,String pileNo) {
        RcOrderTrace rcOrderTrace = new RcOrderTrace();

        rcOrderTrace.setOrderNum(orderInfo.getOrderNum());
        rcOrderTrace.setElecPileId(orderInfo.getElecPileId());
        rcOrderTrace.setElecStationId(orderInfo.getElecStationId());
        rcOrderTrace.setPileNo(pileNo);
        rcOrderTrace.setPower(power);
        rcOrderTrace.setSoc(soc.intValue());
        rcOrderTrace.setCreatedTime(new Date());

        rcOrderTraceMapper.insertSelective(rcOrderTrace);
    }


}
